using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimationSystem : LogicSystemBase
{
    private int _count = 0;
    protected override void Execute(IEntity entity)
    {
        if(_count > 60)
        {
            Animation animation = entity.GetComponent<AniConponent>().Animation;
            animation.Play("Test");
            _count = 0;
        }
        else
        {
            _count++;
        }
    }

    protected override bool ExecuteCondition(IEntity entity)
    {
        return entity.GetComponent<AniConponent>().Animation != null &&
            entity.GetComponent<PlayerComponent>().Transform != null;
    }

    protected override Type[] Listener()
    {
        return new[]{ typeof(AniConponent)};
    }
}
